//
//  lon.m
//  10-10
//
//  Created by 钟纪旺 on 16/12/1.
//  Copyright © 2016年 zjw. All rights reserved.
//

#import "lon.h"
#import "lonCell.h"



@interface lon ()<UICollectionViewDelegate,UICollectionViewDataSource>{
    
    UICollectionView *collectionview;
    UICollectionViewFlowLayout *layout;
}

@end

@implementation lon
static NSString *const Identifier = @"cell1";
- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    layout = [[UICollectionViewFlowLayout alloc]init];
    layout.itemSize = self.view.frame.size;
    layout.minimumLineSpacing = 0;
    layout.minimumInteritemSpacing = 0;
    layout.scrollDirection =UICollectionViewScrollDirectionHorizontal;
    collectionview = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout];
    collectionview.delegate =self;
    collectionview.dataSource =self;
    collectionview.pagingEnabled =YES;
    
    [self.view addSubview:collectionview];
    [collectionview registerClass:[lonCell class] forCellWithReuseIdentifier:Identifier];
    // Do any additional setup after loading the view.
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.images.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    lonCell *cell = [collectionview dequeueReusableCellWithReuseIdentifier:Identifier forIndexPath:indexPath];
    cell.imagVi.image = self.images[indexPath.item];
    return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    [self dismissViewControllerAnimated:YES completion:nil];
    

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
